package itbour.onetouchshow.activity;

import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;

import butterknife.BindView;
import itbour.onetouchshow.R;
import itbour.onetouchshow.base.mvp.MVPBaseActivity;
import itbour.onetouchshow.widget.CustomVideoView;

/**
 * Created by Yang on 2017/12/16.
 */

public class BootVideoPalyActivity extends MVPBaseActivity {
    @BindView(R.id.videoview)
    CustomVideoView videoview;

    @Override
    public void loadSucceed(String result) {

    }

    @Override
    public void loadFaild(String error) {

    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_boot_videoplay;
    }

    @Override
    protected void afterCreate(Bundle savedInstanceState) {
        //   animationView.setAnimation("hello-world.json");
        //   animationView.loop(true);
        // animationView.setImageAssetsFolder("botoneimage/");
        //设置播放加载路径
        videoview.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.opening_01));
        //播放
        videoview.start();
        /**
         * 视频或者音频到结尾时触发的方法
         */
        videoview.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
            @Override
            public void onCompletion(MediaPlayer mp) {
                openActivity(BootPageActivity.class);
                finish();
            }
        });

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

}
